import { arrHasData } from '/@/utils';

export const rules = {
	parentId: [{ required: true, trigger: 'change' }],
	name: [{ required: true, trigger: 'blur' }],
	score: [{ required: true, trigger: 'blur' }],
};
export const useSearch = () => {
	const searchForm = ref({
		status: -1,
	});
	return {
		searchForm,
	};
};
export const usePic = (ruleForm) => {
	const isShowPicSelector = ref(false);

	return {
		isShowPicSelector,
		selectPic() {
			isShowPicSelector.value = true;
		},
		getPic(pic) {
			if (!arrHasData(pic)) return;
			ruleForm.value.icon = pic[0].imgUrl;
		},
	};
};
